#pragma once
#include <iostream>
#include <string>
#include <list>
#include <stdio.h>
#include <vector>
#include <fstream>
#include <sstream>

class AirInfo;

void readinfo(std::list<AirInfo>& all);

class Customer
{
	friend void Order(std::list<AirInfo>& allAirInfo, std::list<Customer>& allCu);
public:
	Customer(std::string& name, std::string& IDcard, std::string& SeatClass)
		:_name(name), _IDcard(IDcard), _SeatClass(SeatClass)
	{}

	Customer()
	{}

	std::string& GetName()
	{
		return _name;
	}
	std::string& GetID()
	{
		return _IDcard;
	}
	std::string& GetSeatClass()
	{
		return _SeatClass;
	}

	void addTicket(std::string& AirNo)
	{
		BookedAirNo.push_back(AirNo);
	}

	bool Search(std::string& Info, int option = 1)
	{
		switch (option)
		{
		case 1:
			return Info == _name ? true : false;
		case 2:
			return Info == _IDcard ? true : false;
		case 3:
			return Info == _SeatClass ? true : false;
		default:
			printf("\n");
		}
		return false;
	}


private:
	std::string _name;
	std::string _IDcard;
	std::string _SeatClass;
	std::vector<std::string> BookedAirNo;
};


class AirInfo
{
	friend void PrintAllAirMsg(const std::list<AirInfo>& all);
	friend void PrintOnce(const AirInfo& info);
	friend void Order(std::list<AirInfo>& allAirInfo, std::list<Customer>& allCu);
public:
	AirInfo(std::string& AirNo, std::string& startDest, std::string& endDest, std::string& day, std::string& duration,
		int price, int remained)
		:_AirNo(AirNo), _startDest(startDest), _endDest(endDest), _day(day), _duration(duration),
		_price(price), _remained(remained)
	{}

	AirInfo()
	{}

	bool Search(std::string& Info, int option = 1)
	{
		switch (option)
		{
		case 1:
			return Info == _AirNo ? true : false;
		case 2:
			return Info == _startDest ? true : false;
		case 3:
			return Info == _endDest ? true : false;
		case 4:
			return Info == _day ? true : false;
		default:
			printf("\n");
		}
		return false;
	}

private:
	std::string _AirNo;
	std::string _startDest;
	std::string _endDest;
	std::string _day;
	std::string _duration;
	int _price;
	int _remained;
};


void Search(std::list<AirInfo>& all);

void ReturnTicket(std::list<AirInfo>& allAirIn, std::list<Customer>& allCu);

void Order(std::list<AirInfo>& allAirInfo, std::list<Customer>& allCu);
